Skip to content

Type Graph/MultiGraph inherited methods with Self#15453

Merged
srittau merged 1 commit intopython:mainfrom
albinoyoda:networkx-graphs-type-base-methods-with-self
Mar 2, 2026
Merged

Type Graph/MultiGraph inherited methods with Self#15453
srittau merged 1 commit intopython:mainfrom
albinoyoda:networkx-graphs-type-base-methods-with-self

Conversation

@albinoyoda
Copy link
Contributor

@albinoyoda albinoyoda commented Feb 22, 2026

Graph.subgraph() returntype is Graph, causing type-issues for inherited classes (DiGraph).

I also propose a fix for a similar method of MultiGraph (the copy method).

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@albinoyoda
Copy link
Contributor Author

ping

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau srittau merged commit b8b4b69 into python:main Mar 2, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants